<extend name="./Application/Admin/View/Layouts/application.html"/>

<block name="content">

    <form class="am-form admin-content" action="{{:U('edit',['id'=>$cate[id]])}}" method="post">

        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf">
                    <strong class="am-text-primary am-text-lg">编辑分类</strong> /
                    <small>Edit Category</small>
                </div>
            </div>

            <hr>

            <div class="am-tabs-bd">
                <div class="am-tab-panel am-fade am-in am-active">

                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            上级分类
                        </div>
                        <div class="am-u-sm-8 am-u-md-3 am-u-end col-end">
                            <select data-am-selected="{btnWidth: '100%',  btnStyle: 'secondary', btnSize: 'sm', maxHeight: 360, searchBox: 1}"
                                    name="parent_id">

                                <eq name="cate.parent_id" value="0">
                                    <option value="0">顶级分类</option>
                                    <else/>
                                    <volist name="categories" id="category">
                                        <option value="{{$category.id}}"
                                        <eq name="category.id" value="$cate.parent_id">selected</eq>
                                        >
                                        {{$category.name}}
                                        </option>
                                    </volist>
                                </eq>

                            </select>
                        </div>
                    </div>

                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            名称
                        </div>
                        <div class="am-u-sm-8 am-u-md-3 am-u-end col-end">
                            <input type="text" name="name" value="{{$cate.name}}" required class="am-input-sm">
                        </div>
                    </div>

                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            排序
                        </div>
                        <div class="am-u-sm-8 am-u-md-3 am-u-end col-end">
                            <input type="text" name="sort_order" value="{{$cate.sort_order}}" class="am-input-sm">
                        </div>
                    </div>

                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">是否显示</div>
                        <div class="am-u-sm-8 am-u-md-10">
                            <label>
                                <input type="radio" name="is_show" value="1"
                                <eq name="cate.is_show" value="1">checked</eq>
                                > 是
                            </label>
                            <label>
                                <input type="radio" name="is_show" value="0"
                                <eq name="cate.is_show" value="0">checked</eq>
                                > 否
                            </label>
                        </div>
                    </div>

                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            商品描述
                        </div>
                        <div class="am-u-sm-8 am-u-md-5 am-u-end col-end">
                            <textarea name="description" id="" cols="20" rows="5">{{$cate.description}}</textarea>
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-8 am-u-md-6 am-u-end col-end">
                            <button type="submit" class="am-btn am-btn-primary am-btn-xs">提交保存</button>
                            <button type="button" class="am-btn am-btn-warning am-btn-xs">放弃保存</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <footer class="admin-content-footer">
        <hr>
        <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
    </footer>


</block>

<block name="js">
    <script src="__PUBLIC__/vendor/validate/jquery.validate.js"></script>
    <script src="__PUBLIC__/vendor/validate/localization/messages_zh.min.js"></script>

    <script>
        $(function () {
            $(".am-form").validate({
                onfocusout: function (element) {
                    $(element).valid();
                }
            });
        });

    </script>

</block>